package com.jx.jingxuan.controller.home;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.jx.jingxuan.R;
import com.jx.jingxuan.base.BaseFragment;
import com.jx.jingxuan.widget.autoViewPager.WAutoViewPager;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * <li>Package:com.jx.jingxuan.controller.home</li>
 * <li>Author: Administrator  </li>
 * <li>Date: 2019/3/18</li>
 * <li>Description:   </li>
 */
public class HomeFragment extends BaseFragment {
    @BindView(R.id.home_banner)
    WAutoViewPager homeBanner;
    Unbinder unbinder;
    @BindView(R.id.home_bao_list)
    RecyclerView homeBaoList;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.home_header, null);
        unbinder = ButterKnife.bind(this, view);

        LinearLayoutManager manager = new LinearLayoutManager(getContext());
        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
        HomeBaoAdapter adapter = new HomeBaoAdapter();
        homeBaoList.setLayoutManager(manager);
        homeBaoList.addItemDecoration(new HomeBaoItemDecoration());
        homeBaoList.setAdapter(adapter);

        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
